import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Julius class
 * @author Hugo Armando Rodríguez Flores 
 * @version May 23th 2013
 */
public class Julius extends Ordinario
{
    /**
     * Gives the properties to an instance of this class.
     */
    public Julius()
    {
        super();
        super.storeImages(3, "jul");
    }
    
    /**
     * Makes Julius act in the current world
     */
    public void act() 
    {
        if (!this.getRemoveFlag())
        {
            super.thomasDetection(10);
            super.attackTiming(120);
            super.act();
        }
        else
            super.removeEnemy();
    }
    
    /**
     * This defines how Julius it is going to attack an instance of Thomas class.
     */
    public void attack()
    {
        switch(Greenfoot.getRandomNumber(15))
        {
            case 5:
                if (!super.getAttackedFlag())
                {
                    this.setImage(super.getElement(2));
                    Actor thomas=getOneIntersectingObject(Thomas.class);
                    if (thomas!=null)
                        ((Thomas)thomas).lowLifePercentageFromOutside(15);
                    super.setAttackedFlag(true);
                }
                break;
        }
    }
}
